package com.yk.customlive.one;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import com.yk.customlive.R;

public class OnePixelActivity extends AppCompatActivity {


    public static final String TAG= OnePixelActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.e("OnePixelActivity","onCreate");

        // 获取本界面的窗口 Window 对象
        Window window = getWindow();
        // 屏幕左上角展示
        window.setGravity(Gravity.START | Gravity.TOP);

        // 将 Activity 设置成 1 像素
        WindowManager.LayoutParams layoutParams = window.getAttributes();
        // 宽高都设置 1 像素
        layoutParams.width = 1;
        layoutParams.height = 1;
        // 放置位置 (0, 0) 坐标开始放置
        layoutParams.x = 0;
        layoutParams.y = 0;

        // 在将布局参数设置会 Window 对象中
        window.setAttributes(layoutParams);

        // 设置界面到 KeepProgressAliveManager 单例对象中 , 用于关闭界面
        OnePixelManager.getmInstance().setmOnePixelActivity(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.e("OnePixelActivity", "onDestroy");
    }
}
